#ifndef FIXER
#define FIXER

#include <vector>
#include "Enums.h"
#include "Cluster.h"
#include "Tree_Of_Clusters.h"
#include "Pile.h"

class Fixer {
public:
    Fixer(double min_ratio, Cluster_Metric metric);

    void set_tree(Tree_Of_Clusters *tree);
    Bad_Split::Type check(Cluster *a, Cluster *b, Cluster *c, Cluster *d);
    Bad_Split::Type check(Cluster *S, Cluster *a, Cluster *b);
    void fix(Bad_Split::Type bad_split_type,
             Cluster*& S1, Cluster*& S2,
             Cluster *a, Cluster *b, Cluster *c, Cluster *d);
    void fix(Bad_Split::Type bad_split_type,
             Cluster *S, Cluster*& ab,
             Cluster *a, Cluster *b);
    void is_stale(Cluster *c);
    void delete_stale_clusters();
    double cluster_distance(Cluster* a, Cluster* b);

    double min_good_split_ratio;
    std::vector<Cluster*> stale_clusters;

    Cluster_Metric cluster_metric;
    Tree_Of_Clusters *tree;
};
#endif
